﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Client.ShopServiceReference;
using Server;

namespace Client
{
    public class LoginModel : ILoginModel
    {
        /// <summary>
        /// User login. 
        /// </summary>
        /// <param name="login"></param>
        /// <param name="password"></param>
        /// <returns>
        /// -1 - login or password is incorrect
        /// UserRole const - if logged in
        /// </returns>
        public int Login(string login, string password)
        {
            User user = Service.Instance.Login(login, password, null);//what is null???

            //if login or password is incorrect
            if (user.IsNull == true)
            {
                return -1; 
            }

            //login ok, return user role
            return (int)user.Role;            
        }

    }//class
}
